package cn.com.xf.dao.impl;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import cn.com.xf.dao.TblSiteWeeklyDAO;
import cn.com.xf.dao.support.XFSqlMapClientDaoSupport;
import cn.com.xf.domain.TblSiteJob;
import cn.com.xf.domain.TblSiteWeekly;

@Repository
public class TblSiteWeeklyDAOImpl extends XFSqlMapClientDaoSupport implements TblSiteWeeklyDAO {



	@Override
	public int selectCount() {
		return (Integer)getSqlMapClientTemplate().queryForObject("TBL_SITE_WEEKLY.ibatorgenerated_selectCount");
	}

	@Override
	public List<TblSiteWeekly> selectWeekly(int begin, int pageSize) {
		Map<String,Object> map = new HashMap<String,Object>();
		int end = begin + pageSize;
		begin = begin + 1;
		map.put("begin", begin);
		map.put("end", end);
		List<TblSiteWeekly> list = getSqlMapClientTemplate().queryForList("TBL_SITE_WEEKLY.ibatorgenerated_selectAndOrder", map);
		return list;
	}

	@Override
	public BigDecimal insert(TblSiteWeekly tblSiteWeekly) {
		BigDecimal result = (BigDecimal)getSqlMapClientTemplate().insert("TBL_SITE_WEEKLY.ibatorgenerated_insert", tblSiteWeekly);
		return result;
	}

	@Override
	public int deleteByWeeklyID(BigDecimal id) {
		TblSiteWeekly tblSiteWeekly = new TblSiteWeekly();
		tblSiteWeekly.setId(id);
		int rows = getSqlMapClientTemplate().delete("TBL_SITE_WEEKLY.ibatorgenerated_deleteByWeeklyID", tblSiteWeekly);
		return rows;
	}
}